<template>
  <div class="ly-box">
    <div class="adImg"></div>
  </div>
</template>

<script>
  import http from "@/http";
  export default {
    data() {
      return {};
    },
    created: function () {

    },
    mounted: function () {
      this.openDoor()
    },
    methods: {
      openDoor: function () {
        const mac = this.$route.query['mac']
        http.get('/communityApps/acs/open/door/' + mac).then(resp => {
          console.log(resp)
          if (resp.data.code === 20000) {
            if (resp.data.data === true) {
              this.$dialog.toast({
                mes: '开门成功',
                timeout: 2000,
                icon: 'success',
              });
            } else {
              this.$dialog.toast({
                mes: '开门失败，请联系管理员',
                timeout: 2000,
                icon: 'error'
              });
            }
          } else {
            this.$dialog.toast({
              mes: resp.data.message,
              timeout: 2000,
              icon: 'error'
            });
          }
        })
      }
    }
  }
  ;
</script>

<style scoped lang="scss">
  .ly-box {
    width: 100%;
    height: 100%;
    .adImg {
      width: 100%;
      height: 100%;
      background-image: url(./img/ad3.jpg);
      background-repeat: no-repeat;
      background-position: center;
      background-size: cover;
    }
  }
</style>
